<template>
	<view class="content">
		<view class="address-block block">
			<view class="info-item">
				<view class="iconfont">
					<image :src="info.deliveryVo.result.logo" class="img"></image>
				</view>
				<view class="title-item">
					<view class="title">
						<view class="text"><text
								style="color: #46AD35;">{{info.deliveryVo.result.expName}}</text>：{{info.deliveryVo.result.number}}
						</view>
					</view>
				</view>
			</view>
			<view class="info-item">
				<view class="iconfont icon-daishouhuo"></view>
				<view class="title-item">
					<view class="title">
						<view class="text">订单编号：{{info.orderSn}}</view>
						<view class="text">收货地址：{{info.addressModel.area}}{{info.addressModel.address}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="logistics-block block">
			<view v-for="(item, index) in list" :key="item.id" class="one">
				<view class="middle-block">
					<view class="onedot">
						<view class="round"></view>
					</view>
					<view class="oneline"></view>
				</view>
				<view class="top-block">
					<view class="top-item">
						<view class="title">{{item.status}}</view>
						<view class="time">{{item.time}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getIntegralOrderById
	} from '@/api/integral.js';
	import {
		showToast
	} from '@/util/util.js'
	export default {
		data() {
			return {
				info: {
					deliveryVo: {
						result: {
							expName: '',
							number: '',
							list: [],
							logo: '',
							expName: ''
						}
					},
					addressModel: {
						area: '',
						address: ''
					},
					orderSn: ''
				},
				id: null,
				list: []
			}
		},
		methods: {
			getIntegralOrderById() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getIntegralOrderById({
					id: this.id
				}).then((res) => {
					this.info = res
					this.list = res.deliveryVo.result.list
				})
			},
		},
		onLoad(e) {
			this.id = e.id;
			this.getIntegralOrderById()
		},
	}
</script>

<style lang="scss">
	.content {
		width: 100%;
		height: 100vh;
		padding-bottom: 20rpx;
		background: #EFEFEF;
		padding: 30rpx;

		.block {
			background-color: #fff;
			border-radius: 20rpx;
			padding: 30rpx;
		}

		.address-block {
			margin-bottom: 30rpx;

			.info-item:first-child {
				border-top: none;
				padding-bottom: 20rpx;
			}

			.info-item {
				display: flex;
				align-items: center;
				border-top: 1px solid #EFEFEF;

				padding-top: 20rpx;

				.iconfont {
					width: 60rpx;
					font-size: 42rpx;
					display: flex;
					align-items: center;
					justify-content: center;

					.img {
						width: 50rpx;
						height: 50rpx;
					}
				}

				.title-item {
					width: calc(100% - 60rpx);
					display: flex;
					align-items: center;

					.title {
						width: 100%;

						.text {
							width: 100%;
							font-size: 28rpx;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
							margin-top: 10rpx;
						}
					}
				}
			}
		}

		.logistics-block {
			.one {
				position: relative;
				padding-bottom: 10rpx;
				display: flex;
				width: 100%;

				.middle-block {
					.onedot {
						left: 20rpx;
						width: 32rpx;
						height: 32rpx;
						position: absolute;
						background-color: #ffffff;
						box-shadow: 0px 2px 4px rgba($color: #000000, $alpha: 0.11);
						border-radius: 50%;
						display: flex;
						justify-content: center;
						align-items: center;
						z-index: 1;

						.round {
							width: 20rpx;
							height: 20rpx;
							border-radius: 50%;
							background: linear-gradient(to right, #FF2F34, #FF6B18);
						}
					}

					.oneline {
						position: absolute;
						left: 30rpx;
						height: calc(100% - 24rpx);
						border-left: 4px solid #eeeeee;
						margin-top: 24rpx;
					}
				}

				.top-block {
					margin-bottom: 30rpx;
					margin-left: 70rpx;
					width: calc(100% - 80rpx);

					.top-item {
						.title {
							font-size: 30rpx;
						}

						.time {
							font-size: 26rpx;
							color: #999;
							margin-top: 10rpx;
						}
					}
				}
			}
		}
	}
</style>